n = int(input())
for i in range(n):
    n,m,l = map(int,input().split())
    ans = max(l-m,m-n)
    print(ans-1)

